import { ApiProperty } from "@nestjs/swagger";
import { IsInt, IsNotEmpty, IsArray } from "class-validator";
import { Transform } from "class-transformer";

export class AssiginDataDto {
  @ApiProperty({ required: true, description: '字典值id' })
  @IsInt({ message: '字典值id必须为整数' })
  @Transform(value => parseInt(value, 10))
  @IsNotEmpty({ message: '字典值id不能为空' })
  readonly dictId: number

  @ApiProperty({ required: true, description: '资源列表' })
  @IsArray({ message: '资源id列表' })
  @IsNotEmpty({ message: '资源id不能为空' })
  readonly dictList: { [propsName: string]: any }[]
}